﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FineSoft.Models
{
	public class EventValue : System.Runtime.Serialization.ISerializable
	{
		public Event Event { get; set; }
		public string FuctionName { get; set; }

		#region ISerializable 成员

		public EventValue(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
		{
			this.Event = ((ExtClass)InitialData.Classes[info.GetInt32("EventOwner")]).Events[info.GetInt32("Event")];
			this.FuctionName = info.GetString("FuctionName");
		}

		void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
		{
			info.AddValue("EventOwner", this.Event.OwnerIndex);
			info.AddValue("Event", System.Array.IndexOf(((ExtClass)InitialData.Classes[this.Event.OwnerIndex]).Events, this));
			info.AddValue("FuctionName", this.FuctionName);
		}

		#endregion
	}
}